<div class="row block">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <span class="panel-controls">
                <button class="btn btn-primary" uib-tooltip="刷新" ng-click="config.reload()" ><i class="fa fa-refresh fa-fw" ng-class="{'fa-spin':!config.loadover}" ></i></button>
                <button class="btn btn-primary" uib-tooltip="保存" ng-click="config.save()"><i class="fa fa-floppy-o" aria-hidden="true"></i></button>
                <button class="btn btn-primary" uib-tooltip="关闭" ng-click="config.cancel()"><i class="fa fa-times" aria-hidden="true"></i></button>
            </span>
            <h5>{{ config.nodeStr }} => {{ config.name }}</h5>
        </div>

        <div class="panel-body">
            <div class="pt20">
                <div>
                    <div class="form-group admin-form">
                        <div class="row">
                            <label class="col-md-2 control-label fwbold" >开关:</label>
                            <div class="col-md-10">
                                <label class="switch switch-system mt5">
                                    <input type="checkbox" id="check_status" ng-model="config.status">
                                    <label for="check_status" data-on="ON" data-off="OFF"></label>
                                </label>
                            </div>
                        </div>

                        <div class="row">
                            <label class="col-md-2 control-label fwbold" >定时发现tags:</label>
                            <div class="col-md-10">
                                <label class="switch switch-system mt5">
                                    <input type="checkbox" id="check_autofindtags" ng-model="config.autofindtags">
                                    <label for="check_autofindtags" data-on="ON" data-off="OFF"></label>
                                </label>
                            </div>
                        </div>

                        <div class="row">
                            <label class="col-md-2 control-label fwbold" >自动构建:</label>
                            <div class="col-md-10">
                                <label class="switch switch-system mt5">
                                    <input type="checkbox" id="check_autobuild" ng-model="config.autobuild">
                                    <label for="check_autobuild" data-on="ON" data-off="OFF"></label>
                                </label>
                            </div>
                        </div>


                        <div class="row">
                            <label class="col-md-2 control-label fwbold">代码地址:</label>
                            <div class="col-md-8"> <input class="form-control" ng-model="config.project.addr" ng-change="config.changeaddr()" placeholder="git或者svn地址,如:git@git.liebaopay.com:ops/test.git ; 如果使用文件上传方式，请写openc3://*"/> </div>
                            <a class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="right" target='_blank' ng-href="/book/流水线三种代码来源/" uib-tooltip="查看代码地址帮助" aria-hidden="true" style="padding-top: 11px;font-size: larger;"></a>
                        </div>

                        <div class="row">
                            <label class="col-md-2 control-label fwbold">tag正则:</label>
                            <div class="col-md-4"> <input class="form-control" ng-model="config.project.tag_regex" placeholder="tag的正则表达式,只接受release开头"/> </div>
                        </div>
                    </div>

                   <div class="row" >
                        <label class="col-md-2 control-label fwbold">代码仓库票据</label>
                        <div class="col-md-6 form-inline">
                            <select class="form-control"  ng-model="config.project.ticketid" > 
                                 <option ng-repeat="x in config.ticketinfo" value="{{x.id}}">{{x.name}}</option>
                            </select>
                        </div>
                    </div>


                    <div class="form-group admin-form row">
                        <label class="col-md-2 control-label fwbold" >依赖:</label>
                        <div class="col-md-2">
                            <label class="switch switch-system mt5">
                                <input type="checkbox" id="check_rely" ng-model="config.rely">
                                <label for="check_rely" data-on="ON" data-off="OFF"></label>
                            </label>
                        </div>
                        <div class="col-md-3">
                            <a ng-if="config.rely" href="javascript:void(0)" ng-click="config.editrely( '' )">编辑依赖</a>
                        </div>
                    </div>


                   <div class="row" >

                        <label class="col-md-2 control-label fwbold">build镜像:</label>

                        <div class="col-md-6 form-inline">

                            <select class="form-control"  ng-model="config.project.buildimage" > 
                                 <option ng-repeat="x in config.dockerimage" value="{{x.id}}">{{x.name}}</option>
                            </select>
                            <a ng-show="config.project.buildimage" class="btn btn-system" target='_blank' ng-href="/api/ci/dockershell?image={{config.project.buildimage}}&projectid={{config.projectid}}">调试</a>
                            <!--<a class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="right" ng-click="config.show_help()" uib-tooltip="添加镜像的方法" aria-hidden="true" style="padding-top: 11px;font-size: larger;"></a> -->
                        </div>
                    </div>

                    <div class="row" ng-if="config.project.buildimage" class="form-group">
                        <label class="col-md-2 control-label fwbold">构建脚本</label>
                        <div class="col-md-10">
                            <pre style="min-height: 100px;" ng-dblclick="dataEdit=true" ng-show="!dataEdit" class="text-left"  ng-bind-html="config.project.buildscripts| highlight"></pre>
                            <textarea style="min-height: 100px;" ng-blur="dataEdit=false" ng-show="dataEdit" class="form-control" rows="3" cols="20" ng-model="config.project.buildscripts" > </textarea>
                            <span class="help-block">构建时候执行的脚本.将构建成功后的文件移动到打包目录内.脚本运行结束后dist目录存在即算构建成功</span>
                            <span class="help-block">当前脚本:/build/run.项目路径:/build/data.打包目录:/build/dist</span>
                        </div>
                    </div>

                    <div class="row">
                        <label class="col-md-2 control-label fwbold">触发脚本:</label>
                        <div class="col-md-8"> <input class="form-control" ng-model="config.project.follow_up" placeholder="构建完成后触发脚本"/> </div>
                        <a class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="right" target='_blank' ng-href="/book/构建触发脚本/" uib-tooltip="查看脚本帮助" aria-hidden="true" style="padding-top: 11px;font-size: larger;"></a>
                    </div>
                    <div class="row" >
                        <label class="col-md-2 control-label fwbold">脚本票据</label>
                        <div class="col-md-6 form-inline">
                            <select class="form-control"  ng-model="config.project.follow_up_ticketid" > 
                                 <option ng-repeat="x in config.ticketinfo" value="{{x.id}}">{{x.name}}</option>
                            </select>
                        </div>
                        <a class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="left" target='_blank' ng-href="/book/票据/" uib-tooltip="查看票据帮助" aria-hidden="true" style="padding-top: 11px;font-size: larger;"></a>
                    </div>
                    <div class="row">
                        <label class="col-md-2 control-label fwbold">消息通知人:</label>
                        <div class="col-md-8"> <input class="form-control" ng-model="config.project.notify" placeholder="构建情况通知人，多个人用逗号分隔"/> </div>
                    </div>
                    <hr style="margin: 5px" >
                    <div class="row">
                        <label class="col-md-12 control-label fwbold">发布配置:</label>
                    </div>
 
                    <div class="form-group admin-form row">
                        <label class="col-md-3 control-label fwbold" >自动触发线上发布:</label>
                        <div class="col-md-2">
                            <label class="switch switch-system mt5">
                                <input type="checkbox" id="check_online" ng-model="config.callonlineenv">
                                <label for="check_online" data-on="ON" data-off="OFF"></label>
                            </label>
                        </div>
                        <label class="col-md-3 control-label fwbold" >自动触发测试发布:</label>
                        <div class="col-md-2">
                            <label class="switch switch-system mt5">
                                <input type="checkbox" id="check_test" ng-model="config.calltestenv">
                                <label for="check_test" data-on="ON" data-off="OFF"></label>
                            </label>
                        </div>
                    </div>

                    <hr style="margin: 5px">

                    <div class="row">
                        <button class="btn btn-primary" uib-tooltip="编辑测试分组" ng-click="config.editgroup('test')" style="float: right" ><i class="fa fa-cogs fa-1x" >  测试分组</i></button>
                    </div>
                    <div class="row" ng-repeat="group in showIPstr.test">
                        <div class="col-sm-12 form-group">
                            <label class="col-sm-2 control-label">分组{{$index+1}}: ({{group.num}}台机器)
                            </label>
                            <div class="col-sm-9" style="padding-top: 10px">
                                <p ng-repeat="ip in group.infos">{{ip}}</p>
                           </div>
                       </div>
                   </div>

                   <hr style="margin: 5px">

                   <div class="row">
                       <button class="btn btn-primary" uib-tooltip="编辑线上分组" ng-click="config.editgroup('online')" style="float: right" ><i class="fa fa-cogs fa-1x" >  线上分组</i></button>
                   </div>
                   <div class="row" ng-repeat="group in showIPstr.online">
                       <div class="col-sm-12 form-group" style="margin: 0px">
                           <label class="col-sm-2 control-label">分组{{$index+1}}: ({{group.num}}台机器)
                          </label>
                          <div class="col-sm-9" style="padding-top: 10px">
                             <p ng-repeat="ip in group.infos">{{ip}}</p>
                         </div>
                      </div>
                   </div>

                   <hr style="margin: 5px">

                    <div class="row" >
                        <button class="btn btn-primary" uib-tooltip="编辑作业" ng-click="config.editjob()" style="float: right" ><i class="fa fa-cogs fa-1x" >  作业步骤</i></button>
                    </div>
                   <div class="row" ng-repeat="step in config.jobStep">
                       <div class="col-sm-12 form-group" style="margin: 0px">
                           <label class="col-sm-12 control-label">第{{$index+1}}步:({{step}})
                          </label>
                      </div>
                   </div>

                </div>

            </div>
        </div>

    </div>

</div>
